/**
 * Created by oneminute on 8/30/14.
 */

exports = module.exports = {
    SYSTEM_ERROR: {
        code: 0,
        message: 'err',
        err: null
    },
    USER_HAS_BEEN_REMOVED: {
        code: 1,
        message: 'user has been removed',
        err: null
    },
    LOGIN_USER_NOT_FOUND: {
        code: 1000,
        message: 'nexist',
        err: null
    },
    LOGIN_WRONG_PASSWORD: {
        code: 1001,
        message: 'err',
        err: null
    },
    LOGIN_ALREADY_ONLINE: {
        code: 1002,
        message: 'online',
        err: null
    },
    REGISTER_USER_EXISTED: {
        code: 1010,
        message: 'exist',
        err: null
    },
    REGISTER_EMAIL_EXISTED: {
        code: 1011,
        message: 'exist',
        err: null
    },
    REGISTER_NO_EMAIL: {
        code: 1012,
        message: 'no email',
        err: null
    },
    VALIDATE_PROPERTY_NOT_FOUND: {
        code: 2000,
        message: 'property not found',
        err: null
    },
    VALIDATE_INVALIDATE_VALUE: {
        code: 2001,
        message: 'invalidate value',
        err: null
    },
    ARANGODB_SYSTEM_ERROR: {
        code: 3000,
        message: 'arangodb internal error',
        err: null
    },
    REQUEST_ERROR: {
        code: 4000,
        message: 'err',
        err: null
    },
    REQUEST_TEMPUSER_ERROR: {
        code: 4001,
        message: 'temp user',
        err: null
    },
    REQUEST_MISS_VALUE: {
        code: 4002,
        message: 'miss some value',
        err: null
    },
    REQUEST_DATA_NOT_BELANG_USER: {
        code: 4003,
        message: 'the data not belong you',
        err: null
    },
    REQUEST_NO_COMMODITY: {
        code: 4004,
        message: 'commodity not found',
        err: null
    },
    REQUEST_NO_DEMAND: {
        code: 4005,
        message: 'demand not found',
        err: null
    },
    REQUEST_NO_GIFT: {
        code: 4006,
        message: 'gift not found',
        err: null
    },
    REQUEST_SHOP_NOT_IN_BUSINESS: {
        code: 4007,
        message: 'shop not in business',
        err: null
    },
    REQUEST_NO_DEVICE: {
        code: 4100,
        message: 'no device',
        err: null
    },
    REQUEST_MISS_PARAMETER: {
        code: 4200,
        message: 'miss parameter',
        err: null
    },
    REQUEST_PARAMETER_INVALIDATE_TYPE: {
        code: 4201,
        message: 'invalidate parameter type',
        err: null
    },
    REQUEST_PARAMETER_INVALIDATE_VALUE: {
        code: 4202,
        message: 'invalidate parameter value',
        err: null
    },
    REQUEST_SMS_ERROR: {
        code: 4300,
        message: 'sms error',
        err: null
    },
    REQUEST_SMS_TOO_FREQUENT: {
        code: 4301,
        message: 'too frequent',
        err: null
    },
    REQUEST_SMS_NO_CODE: {
        code: 4302,
        message: 'no code',
        err: null
    },
    REQUEST_SMS_CODE_EXPIRE: {
        code: 4303,
        message: 'expire',
        err: null
    },
    REQUEST_SMS_WRONG_CODE: {
        code: 4304,
        message: 'wrong code',
        err: null
    },
    IMAGE_ERROR: {
        code: 5000,
        message: 'image error',
        err: null
    },
    SEND_EMAIL_ERROR: {
        code: 6000,
        message: 'send email error',
        err: null
    },
    getError: function (_err, _opts) {
        var obj = Object.create(_err);
        obj.err = _opts;
        return obj;
    }
};